Socket
Socket
Sign inDemoInstall

prettify-xml

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettify-xml

Pretty-print XML.


Version published
Maintainers
1
Created
Source

prettify-xml

Build Status Code Coverage version downloads MIT License PRs Welcome Commitizen friendly

Pretty print xml.

This is a small package that synchronously pretty prints XML/HTML.

Usage

const prettifyXml = require('prettify-xml')

const input = '<div><p>foo</p><p>bar</p></div>'

const expectedOutput = [
  '<div>',
  '  <p>foo</p>',
  '  <p>bar</p>',
  '</div>',
].join('\n')

const options = {indent: 2, newline: '\n'} // 2 spaces is default, newline defaults to require('os').EOL
const output = prettifyXml(input, options) // options is optional

assert(output === expectedOutput)

FAQs

Package last updated on 20 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc